
import {View, Text, ScrollView} from '@tarojs/components'
import {useState, useEffect} from 'react'
import {useHistory} from "react-router-dom"
import {AtGrid} from "taro-ui"
import Taro, {useDidShow} from '@tarojs/taro'
import "taro-ui/dist/style/components/grid.scss"


const NavContent = ({state, allClassify}) => {
  console.log(allClassify)

  // 点击每一个tip时
  const tipCheck = (item, index) => {
    console.log(item, index)
    Taro.navigateTo({
      url: '../classifySearch/classifySearch'
    })
  }

  return (
    <View className='navContent'>
      <ScrollView
        scrollIntoView={state}
        className='scrollview'
        scrollY
        scrollWithAnimation
        enableBackToTop
      >
        {allClassify.map(v => (<view id={`goods${v.id}`} key={v.id} className='list'>
          <View className='tipTit'>{v.name}</View>
          <AtGrid data={v.children} onClick={tipCheck} />
        </view>))}
      </ScrollView>

    </View>
  )
}

export default NavContent
